package s02;

import java.text.ParseException;
import java.util.Calendar;

/**
 * @ClassName CalendarDemo03
 * @Description set方法用来设置指定字段的值
 * @Author Li
 * @Date 2022/8/3 11:46
 * @ModifyDate 2022/8/3 11:46
 * @Version 1.0
 */
public class CalendarDemo03 {
    public static void main(String[] args) throws ParseException {
        // 创建Calendar对象
        Calendar calendar = Calendar.getInstance();
        // 设置年
        calendar.set(Calendar.YEAR, 2345);
        // 设置月
        calendar.set(Calendar.MONTH, 05);
        // 设置日
        calendar.set(Calendar.DAY_OF_MONTH, 07);
        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH) + 1;
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        System.out.println(year + "年" + month + "月" + day + "日");
    }
}
